package com.chen.mapper;

import com.chen.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

    @Insert("insert into users(name,age,sex,address) value(#{name},#{age},#{sex},#{address})")
    public int addUser(User user);

    @Select("select *from users")
    public List<User> queryAll();

    @Select("select *from users where id=#{id}")
    public User queryById(Long id);

    @Update("update users set name=#{name} where id=#{id}")
    public int updateUser(User user);

    @Delete("delete from users where id=#{id}")
    public int deleteUser(Long id);

    @Select("select *from users where name=#{name}")
    public User queryByName(String name);
}
